package legumes.client.services.callbacks;

import java.util.Collection;

import legumes.client.services.LegumesServicesHelper;
import legumes.client.services.util.rpc.SequencableRPCCall;
import legumes.shared.domain.Order;

public class GetOrdersCallback extends SequencableRPCCall<Collection<Order>> {

	private Collection<Order> orders;
	private long sellSessionId;

	public GetOrdersCallback(long sellSessionId_) {
		sellSessionId = sellSessionId_;
	}

	@Override
	protected void doCall() {
		LegumesServicesHelper.LEGUMES_SERVICES.getOrders(sellSessionId, this);
	}

	@Override
	public void onSuccess(Collection<Order> result_) {
		orders = result_;
		callNext();
	}

	public Collection<Order> getOrders() {
		return orders;
	}

}